package com.yanchangapp.factory;

import com.yanchangapp.ui.fragment.mail.MailContactFragment;
import com.yanchangapp.ui.fragment.mail.MailListFragment;

public class MailHomeFactory {
    private MailContactFragment mMailContactFragment = null;
    private MailListFragment mMailListFragment = null;

    private MailHomeFactory(){

    }

    private static class MailHomeFactoryHolder{
        private static final MailHomeFactory M_INSTANCE = new MailHomeFactory();
    }

    public static MailHomeFactory getInstance(){
        return  MailHomeFactoryHolder.M_INSTANCE;
    }

    public MailContactFragment getMailContactFragment(){
        if (mMailContactFragment == null){
            synchronized (MailHomeFactory.class){
                if (mMailContactFragment == null){
                    mMailContactFragment = new MailContactFragment();
                }
            }
        }
        return  mMailContactFragment;
    }

    public MailListFragment getMailListFragment(){
        if (mMailListFragment == null){
            synchronized (MailHomeFactory.class){
                if (mMailListFragment == null){
                    mMailListFragment = new MailListFragment();
                }
            }
        }
        return mMailListFragment;
    }

}
